package com.tgy.junit;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/***
 * @ClassName: MyTestDemo
 * @Description: 测试自己的单元测试注解
 * @Auther: 送一一块二向箔
 * @Date: 14:17 2021/12/2
 * @version : V1.0
 */
public class MyTestDemo {
    public static void main(String[] args) throws InstantiationException, IllegalAccessException, InvocationTargetException {
        Class<TestJunit> c1 = TestJunit.class;
        Method[] declaredMethods = c1.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            boolean present = declaredMethod.isAnnotationPresent(MyTest.class);
            if (present) {
                declaredMethod.invoke(c1.newInstance());
            }
        }

    }
}
